package com.andy.buyu.server.dto;

import java.util.List;

import com.andy.buyu.server.entity.UsrGameLog;
import com.andy.buyu.server.game.GameConf;
import com.andy.buyu.server.game.GameUser;

import io.netty.buffer.ByteBuf;

/**
 * 捕多个鱼207
 * @author cuiwm
 */
public class MultCatchMessage extends BaseMessage{
	
    private Long uid;
    private int bullet;
    private List<UsrGameLog> logs;
    private GameUser user;
    
    public MultCatchMessage(Long uid,int bullet,List<UsrGameLog> logs, GameUser user) {
    	this.uid = uid;
    	this.bullet = bullet;
    	this.logs = logs;
    	this.user = user;
	}

	@Override
	public void writeBody(ByteBuf buf) {
		writeString(buf, uid.toString());
		buf.writeByte(bullet);
		buf.writeInt(logs.size());
		for(UsrGameLog log:logs){
			buf.writeInt(log.getScriptId());
			buf.writeInt(log.getAddCoin());
			buf.writeInt(log.getRate());
			buf.writeInt(log.orate());
			buf.writeInt(log.yrate());
		}
		if(user == null) {
			buf.writeByte(0);
			buf.writeInt(0);
			buf.writeByte(0);
		}else {
			buf.writeByte(user.getLastShell());
			buf.writeInt(GameConf.getSpecialBullet(user.getLastShell()).getLimitTime());
			buf.writeByte(user.getLastShellNum());
		}
	}


}